<template>
  <div>
    <div class="container" v-if="data">
      <div class="item" v-for="(item, index) in data" :key="index">
        <div class="title1">
          <h3>{{ item.tit }}</h3>
        </div>
        <van-row
          type="flex"
          justify=" space-between"
          style="text-align: center"
          gutter="10"
        >
          <van-col
            span="8"
            v-for="(item1, index) in item.list"
            :key="index"
            style="margin-bottom: 0.5rem"
          >
            <img :src="item1.url" alt="" style="width: 100%" />
            <div>
              <p class="name">{{ item1.name }}</p>
            </div>
          </van-col>
        </van-row>
      </div>
    </div>
  </div>
</template>

<script>
import { fls } from "../api";
export default {
  data() {
    return {
      data: [],
      show: false,
    };
  },
  mounted() {
    this.getdata();
  },
  methods: {
    async getdata() {
      const data = await fls();
      this.data = data.data[0].list;
      console.log(this.data);
    },
    async getlist(id) {
      let datas = { id };
      const data = await fls(datas);
        this.data = data.data[0].list;
        this.show = false
    },
  },
  watch: {
    $route(newValue, oldValue) {
      this.getlist(newValue.query.id);
    },
  },
};
</script>

<style lang="scss" scoped>
.container {
  padding: 0 1rem;
  img {
    display: block;
  }
  .name {
    margin: 0;
    font-size: 00.5rem;
    text-align: center;
  }
}
</style>